Add BSD support (OpenBSD, FreeBSD)#158
Merged
Merged
Conversation
The time/sleep platform block now covers all unix systems via NETCODE_PLATFORM_UNIX instead of only __linux, and falls back to CLOCK_MONOTONIC on systems that do not have the linux-specific CLOCK_MONOTONIC_RAW (the BSDs). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Linux and windows clamp SO_SNDBUF/SO_RCVBUF requests that exceed the OS limit, but the BSDs reject them with ENOBUFS. OpenBSD's default sb_max is 2MB, so requesting the default 4MB socket buffers made every socket create fail and no client or server could start. Halve the request until the OS accepts it (floor 256KB, then fail as before) and log at INFO level when the size was reduced. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes that make netcode build and pass its full test suite on the BSDs, verified on OpenBSD 7.9/arm64 (all 44 tests) and macOS/Linux via CI:
NETCODE_PLATFORM_UNIXinstead of only__linux, and falls back toCLOCK_MONOTONICon systems without the linux-specificCLOCK_MONOTONIC_RAW.Version is bumped to 1.3.5. This unblocks the OpenBSD ports submission (and FreeBSD packaging).
🤖 Generated with Claude Code